#include <iostream>

constexpr int N = 1E5 + 5;

int p[N];

void init() {
    for (int i = 0; i < N; ++i) {
        p[i] = i;
    }
}

int find(int x) {
    if (p[x] != x) {
        p[x] = find(p[x]);
    }
    return p[x];
}